﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Webdiyer.WebControls.Mvc;
using System.Text.RegularExpressions;
using hsgsSHXX.Web.Common;
namespace hsgsSHXX.Controllers
{
    [OutputCache(Duration = 0, VaryByParam = "none")]
    public class SocialController : BaseController
    {
        //
        // GET: /Index/
        BLL.nzlsj nzlsjBLL = new BLL.nzlsj();
        BLL.jkda jkdaBLL = new BLL.jkda();
        BLL.zyy zyyBLL = new BLL.zyy();
        BLL.xsf xsfBLL = new BLL.xsf();
        BLL.qyzl qyzlBLL = new BLL.qyzl();
        BLL.wzsj wzsjBLL = new BLL.wzsj();
        BLL.dhhm dhhmBLL = new BLL.dhhm();
        BLL.hxcjy hxcjyBLL = new BLL.hxcjy();
        BLL.qfqzmc qfqzmcBLL = new BLL.qfqzmc();
        BLL.zpclcj zpclcjBLL = new BLL.zpclcj();
        BLL.wlhsbg wlhsbgBLL = new BLL.wlhsbg();
        BLL.hsrcsc hsrcscBLL = new BLL.hsrcsc();
        BLL.jw jwBLL = new BLL.jw();
        BLL.khxx khxxBLL = new BLL.khxx();
        BLL.mzrz mzrzBLL = new BLL.mzrz();
        BLL.mzbr mzbrBLL = new BLL.mzbr();
        BLL.gcpcs gcpcsBLL = new BLL.gcpcs();
        BLL.gcpcscc gcpcsccBLL = new BLL.gcpcscc();
        BLL.rcsc rcscBLL = new BLL.rcsc();
        BLL.wcpcs wcpcsBLL = new BLL.wcpcs();
        BLL.zzc zzcBLL = new BLL.zzc();

        /// <summary>
        /// 社会信息资源库
        /// </summary>
        private BLL.SHXX SHXXBLL = new BLL.SHXX();

        public ActionResult Index()
        {
            //ViewData["LoginId"] = OperateSession.get("LoginId") == null ? "" : OperateSession.get("LoginId");
            //return SHXX();//社会信息资源库


           // return AjaxSearchPost();

            return View();
        }
       
        /// <summary>
        /// 社会信息资源库
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AjaxSearchPost(int id = 1)
        {
            int pageSize = 10;
            int pageIndex = 1;
            int total = 0;
            List<Model.SHXX> shxxModelList = new List<Model.SHXX>();
            PagedList<Model.SHXX> pagedSHXXModelList = new PagedList<Model.SHXX>(shxxModelList, pageIndex, pageSize, total);
            if (Request.IsAjaxRequest())
                return PartialView("_SHXXSearchPost", pagedSHXXModelList);
           
            return View("SHXX",pagedSHXXModelList);
        }

        [HttpPost]
        public ActionResult AjaxSearchPost(string txtXM , string txtSFZH , string txtLXDH , string txtDZ , string txtBZ,string txtKey,int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";
            if (!string.IsNullOrEmpty(txtXM))
            {
                strWhere += " AND XM LIKE '%" + Fetch.estimateString(txtXM.Trim(), CheckGetEnum.Safety) + "%' ";
            }
            if (!string.IsNullOrEmpty(txtSFZH))
            {
                strWhere += " AND SFZH LIKE '%" + Fetch.estimateString(txtSFZH.Trim(), CheckGetEnum.Safety) + "%' ";
            }
            if (!string.IsNullOrEmpty(txtLXDH))
            {
                strWhere += " AND LXDH LIKE '%" + Fetch.estimateString(txtLXDH.Trim(), CheckGetEnum.Safety) + "%' ";

            }
            if (!string.IsNullOrEmpty(txtDZ))
            {
                strWhere += " AND DZ LIKE '%" + Fetch.estimateString(txtDZ.Trim(), CheckGetEnum.Safety) + "%' ";
            }
            if (!string.IsNullOrEmpty(txtBZ))
            {
                strWhere += " AND BZ LIKE '%" + Fetch.estimateString(txtBZ.Trim(), CheckGetEnum.Safety) + "%' ";
            }
            if (!string.IsNullOrEmpty(txtKey))
            {
                strWhere += " AND CONTAINS(*,'\"" + Fetch.estimateString(txtKey.Trim(), CheckGetEnum.Safety) + "\"')";
            }
            List<Model.SHXX> shxxModelList = new List<Model.SHXX>();
            
            try
            {
                shxxModelList = SHXXBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
                //记录日志
                hsgsSHXX.BLL.OperateLog op = new hsgsSHXX.BLL.OperateLog();
                op.setOperateLog("", "", "", strWhere);
            }
            catch
            {
                pageIndex = 1;

            }
            
            PagedList<Model.SHXX> pagedSHXXModelList = new PagedList<Model.SHXX>(shxxModelList, pageIndex, pageSize, total);
            if (Request.IsAjaxRequest())
                return PartialView("_SHXXSearchPost", pagedSHXXModelList);
            return View(pagedSHXXModelList);
        }

        public ActionResult gcpcsccMain()
        {
            ViewData["LoginId"] = OperateSession.get("LoginId") == null ? "" : OperateSession.get("LoginId");
            return View();
        }
        public ActionResult nzlsj(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            //string strWhere = " FLogID='" + OperateSession.get("LoginId") + "' ";
            //ViewData["txtBeginTime"] = null;
            //ViewData["txtEndTime"] = null;
            //ViewData["txtFSource"] = null;
            //if (Fetch.Post("txtBeginTime") != "" && Fetch.Post("txtEndTime") != "")
            //{
            //    DateTime betinTime;
            //    DateTime endTime;
            //    DateTime.TryParse(Fetch.Post("txtBeginTime"), out betinTime);
            //    DateTime.TryParse(Fetch.Post("txtEndTime"), out endTime);
            //    strWhere += "and (FSendDate between '" + betinTime + "' and '" + endTime + "')";
            //    ViewData["txtBeginTime"] = Fetch.Post("txtBeginTime");
            //    ViewData["txtEndTime"] = Fetch.Post("txtEndTime");
            //}
            //if (Fetch.Post("txtFSource") != "") //短信内容
            //{
            //    if (Fetch.InspectData(Fetch.Post("txtFSource"), CheckGetEnum.Safety) != string.Empty)
            //    {
            //        strWhere += " And FSource like '%" + Fetch.Post("txtFSource") + "%'";
            //        ViewData["txtFSource"] = Fetch.Post("txtFSource");
            //    }
            //}
            string strWhere = "1=1";
            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.nzlsj> FondList = new List<Model.nzlsj>();
            if (strWhere != "1=1")
            {
                FondList = nzlsjBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.nzlsj> pagedFriendList = new PagedList<Model.nzlsj>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult jkda(string strCard, string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {

            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }
            varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csrq between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csrq between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }

            //记录日志
            hsgsSHXX.BLL.OperateLog op = new hsgsSHXX.BLL.OperateLog();
            op.setOperateLog("", "", "", strWhere);

            List<Model.jkda> FondList = new List<Model.jkda>();
            if (strWhere != "1=1")
            {
                FondList = jkdaBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.jkda> pagedFriendList = new PagedList<Model.jkda>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult zyy(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.zyy> FondList = new List<Model.zyy>();
            if (strWhere != "1=1")
            {
                FondList = zyyBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.zyy> pagedFriendList = new PagedList<Model.zyy>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult xsf(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.xsf> FondList = new List<Model.xsf>();
            if (strWhere != "1=1")
            {
                FondList = xsfBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.xsf> pagedFriendList = new PagedList<Model.xsf>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult qyzl(string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.qyzl> FondList = new List<Model.qyzl>();
            if (strWhere != "1=1")
            {
                FondList = qyzlBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.qyzl> pagedFriendList = new PagedList<Model.qyzl>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult wzsj(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.wzsj> FondList = new List<Model.wzsj>();
            if (strWhere != "1=1")
            {
                FondList = wzsjBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.wzsj> pagedFriendList = new PagedList<Model.wzsj>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult dhhm(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += "and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += "and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.dhhm> FondList = new List<Model.dhhm>();
            if (strWhere != "1=1")
            {
                FondList = dhhmBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.dhhm> pagedFriendList = new PagedList<Model.dhhm>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult hxcjy(string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csny between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csny between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.hxcjy> FondList = new List<Model.hxcjy>();
            if (strWhere != "1=1")
            {
                FondList = hxcjyBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.hxcjy> pagedFriendList = new PagedList<Model.hxcjy>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }

        public ActionResult qfqzmc(string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csrq between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csrq between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.qfqzmc> FondList = new List<Model.qfqzmc>();
            if (strWhere != "1=1")
            {
                FondList = qfqzmcBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.qfqzmc> pagedFriendList = new PagedList<Model.qfqzmc>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult zpclcj(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.zpclcj> FondList = new List<Model.zpclcj>();
            if (strWhere != "1=1")
            {
                FondList = zpclcjBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.zpclcj> pagedFriendList = new PagedList<Model.zpclcj>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult wlhsbg(string strCard, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.wlhsbg> FondList = new List<Model.wlhsbg>();
            if (strWhere != "1=1")
            {
                FondList = wlhsbgBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.wlhsbg> pagedFriendList = new PagedList<Model.wlhsbg>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult hsrcsc(string strCard, string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csrq between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csrq between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.hsrcsc> FondList = new List<Model.hsrcsc>();
            if (strWhere != "1=1")
            {
                FondList = hsrcscBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }


            PagedList<Model.hsrcsc> pagedFriendList = new PagedList<Model.hsrcsc>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult jw(string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "xm is not null";

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.jw> FondList = new List<Model.jw>();
            if (strWhere != "xm is not null")
            {
                FondList = jwBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "xm", out total);
            }

            PagedList<Model.jw> pagedFriendList = new PagedList<Model.jw>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult khxx(string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.khxx> FondList = new List<Model.khxx>();
            if (strWhere != "1=1")
            {
                FondList = khxxBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.khxx> pagedFriendList = new PagedList<Model.khxx>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult mzrz(string strCard, string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }
            varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and brxm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csrq between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csrq between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.mzrz> FondList = new List<Model.mzrz>();
            if (strWhere != "1=1")
            {
                FondList = mzrzBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.mzrz> pagedFriendList = new PagedList<Model.mzrz>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult mzbr(string strCard, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.mzbr> FondList = new List<Model.mzbr>();
            if (strWhere != "1=1")
            {
                FondList = mzbrBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.mzbr> pagedFriendList = new PagedList<Model.mzbr>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        //public ActionResult gcpcs(int id = 1)
        //{
        //    int pageSize = 10;
        //    int pageIndex = id;
        //    int total = 0;
        //    string strWhere = "";
        //    if (Fetch.Post("txtCard") != "")
        //    {
        //        strWhere += " sfzh like '%" + Fetch.Post("txtCard") + "%'";
        //    }
        //    List<Model.gcpcs> FondList = gcpcsBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);

        //    PagedList<Model.gcpcs> pagedFriendList = new PagedList<Model.gcpcs>(FondList, pageIndex, pageSize, total);
        //    return View(pagedFriendList);

        //}
        public ActionResult gcpcscc(string txtlsgs, string txtcp, string txtBegin, string txtEnd, string txtzzw, string txtTime1, string txtTime2, string txtkey, int id = 1)
        {
            int pageSize = 20;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(txtlsgs))
            {
                txtlsgs = Server.UrlDecode(txtlsgs);
                txtlsgs = null != txtlsgs ? Fetch.estimateString(txtlsgs, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and lsgs like '%" + txtlsgs + "%'";
            }


            if (!string.IsNullOrEmpty(txtcp))
            {
                txtcp = Server.UrlDecode(txtcp);
                txtcp = null != txtcp ? Fetch.estimateString(txtcp, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and cp like '%" + txtcp + "%'";
            }

            if (!string.IsNullOrEmpty(txtBegin) && !string.IsNullOrEmpty(txtEnd))
            {
                txtBegin = Server.UrlDecode(txtBegin);
                txtEnd = Server.UrlDecode(txtEnd);
                txtBegin = null != txtBegin ? Fetch.estimateString(txtBegin, CheckGetEnum.Safety) : string.Empty;
                txtEnd = null != txtEnd ? Fetch.estimateString(txtEnd, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and yxxl ='" + txtBegin.Trim() + "--" + txtEnd.Trim() + "'";
            }

            if (!string.IsNullOrEmpty(txtzzw))
            {
                txtzzw = null != txtzzw ? Fetch.estimateString(txtzzw, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and zzw =" + txtzzw + "";
            }
            if (!string.IsNullOrEmpty(txtTime1) && !string.IsNullOrEmpty(txtTime1))
            {
                strWhere += " and fcsj between '" + txtTime1 + "' and '" + txtTime1 + "'";
            }
            if (!string.IsNullOrEmpty(txtkey))
            {
                txtkey = Server.UrlDecode(txtkey);
                txtkey = null != txtkey ? Fetch.estimateString(txtkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + txtkey + "%'";
            }
            List<Model.gcpcscc> FondList = new List<Model.gcpcscc>();
            if (strWhere != "1=1")
            {
                FondList = gcpcsccBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.gcpcscc> pagedFriendList = new PagedList<Model.gcpcscc>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult rcsc(string strCard, string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csrq between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csrq between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.rcsc> FondList = new List<Model.rcsc>();
            if (strWhere != "1=1")
            {
                FondList = rcscBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }

            PagedList<Model.rcsc> pagedFriendList = new PagedList<Model.rcsc>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult wcpcs(string strCard, string varName, string txtBirth1, string txtBirth2, string varkey, int txtAgeMin = 0, int txtAgeMax = 0, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(txtBirth1) && !string.IsNullOrEmpty(txtBirth2))
            {

                strWhere += " and csrq between '" + txtBirth1 + "' and '" + txtBirth2 + "'";
            }
            if (txtAgeMin != 0 && txtAgeMax != 0)
            {
                DateTime dt1 = DateTime.Now.AddYears(-txtAgeMin);
                DateTime dt2 = DateTime.Now.AddYears(-txtAgeMax);
                strWhere += " and csrq between '" + dt2 + "' and '" + dt1 + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.wcpcs> FondList = new List<Model.wcpcs>();
            if (strWhere != "1=1")
            {
                FondList = wcpcsBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }
            PagedList<Model.wcpcs> pagedFriendList = new PagedList<Model.wcpcs>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }
        public ActionResult zzc(string strCard, string varName, string varkey, int id = 1)
        {
            int pageSize = 10;
            int pageIndex = id;
            int total = 0;
            string strWhere = "1=1";

            if (!string.IsNullOrEmpty(strCard))
            {
                strCard = Server.UrlDecode(strCard);
                strCard = null != strCard ? Fetch.estimateString(strCard, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and sfzh = '" + strCard + "'";
            }

            if (!string.IsNullOrEmpty(varName))
            {
                varName = Server.UrlDecode(varName);
                varName = null != varName ? Fetch.estimateString(varName, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and xm = '" + varName + "'";
            }
            if (!string.IsNullOrEmpty(varkey))
            {
                varkey = Server.UrlDecode(varkey);
                varkey = null != varkey ? Fetch.estimateString(varkey, CheckGetEnum.Safety) : string.Empty;
                strWhere += " and SearchValues like '%" + varkey + "%'";
            }
            List<Model.zzc> FondList = new List<Model.zzc>();
            if (strWhere != "1=1")
            {
                FondList = zzcBLL.GetFondListByPage(pageSize, pageIndex, strWhere, "", out total);
            }


            PagedList<Model.zzc> pagedFriendList = new PagedList<Model.zzc>(FondList, pageIndex, pageSize, total);
            return View(pagedFriendList);
        }


    }
}
